import React, { useState } from 'react'
import { Dialog } from 'dw-mx-extend'
import { Button, Space } from 'dw-mx'
import Type1Child from './Type2Child'

export default function Type2() {
    const dialogRef = React.useRef();

    const data = {
        id: 135565,
        password: 135565
    }

    const openDialog = async () => {
        const formData = await dialogRef.current.openDialog(Type1Child, {
            title: "type1child",
            width: '40%',
            props: data
        })
        await alert(`id:${formData.id}\npassword:${formData.password}`);
    }
    return <>
        <Space>
            <Button onClick={openDialog}>父子传值</Button>
        </Space>
        <Dialog ref={dialogRef}></Dialog>
    </>
}